home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / butil.arc / BLOAD.BAS < prev    next >
Encoding:
BASIC Source File  |  1985-10-11  |  2.9 KB  |  69 lines

  1.  
  2. 100 ' This programs displays pictures created with PC Paint.  These files 
  3. 110 ' are in the standard "BLOAD" format and as such are fully compatible with
  4. 120 ' systems such as the Polaroid Palette.  There is information regarding
  5. 130 ' color stored in the extra space between the odd and even scan lines.
  6. 140 ' This program demonstrates how to use that information.
  7. 150 '
  8. 160 DEFINT A-Z        'All variables integer
  9. 170 MODESAVE = &H465    'BIOS Mode location
  10. 180 MODEREG = &H3D8    'Mode Register on video controller
  11. 190 BWENABLE = &H4    'Bit to set on Mode byte to control Burst
  12. 200 COLREG = &H3D9    'Color Register on video controller
  13. 210 HIGHENABLE = &H10    'Bit to set on Color byte to control intensity
  14. 220 PALETTEBIT = &H20    'Palette bit in Color byte
  15. 230 SCREEN 0,1,0    'Text mode
  16. 240 WIDTH 80        'Set to 80 columns
  17. 250 KEY OFF
  18. 260 CLS            'Clear the screen
  19. 270 '
  20. 280 ' The program expects the first name of the file only.  For example,
  21. 290 ' "SAILING.PIC" should be entered as "SAILING".
  22. 300 '
  23. 310 INPUT "Enter Picture File Name: ",N$
  24. 320 SCREEN 1,0,0    'Medium Resolution mode
  25. 330 DEF SEG = &HB800    'Video memory segment
  26. 340 BLOAD N$+".PIC",0    'Load the picture file
  27. 350 '
  28. 360 ' Background and palette information are in two of the bytes that are
  29. 370 ' not used by the picture.
  30. 380 '
  31. 390 PALETTE=PEEK(8012)        ' Get palette byte
  32. 400 BACKGROUND=PEEK(8013)    ' Get background byte
  33. 410 '
  34. 420 ' If palette is 3,4, or 5, then high intensity palette is enabled.
  35. 430 ' (See comments below.)
  36. 440 '
  37. 450 IF PALETTE>=3 THEN BACKGROUND = BACKGROUND OR HIGHENABLE
  38. 460 '
  39. 470 ' Palettes 0 and 3 are video palette 1, burst disabled
  40. 480 ' Palettes 1 and 4 are video palette 0, burst disabled
  41. 490 ' Palettes 2 and 5 are video palette 1 (doesn't matter), burst enabled
  42. 500 '
  43. 510 IF PALETTE=0 OR PALETTE=3 THEN PALETTE=1 : BURST = 0 : GOTO 650
  44. 520 IF PALETTE=1 OR PALETTE=4 THEN PALETTE=0 : BURST = 0 : GOTO 650
  45. 530 IF PALETTE=2 OR PALETTE=5 THEN PALETTE=1 : BURST = 1
  46. 540 '
  47. 550 ' The color register accepts one byte with the following format:
  48. 560 ' Bits 0-3: Background color
  49. 570 ' Bit    4: Intensified foreground colors
  50. 580 ' Bit    5: Active palette
  51. 590 ' Bits 6-7: Not used
  52. 600 '
  53. 610 ' The background byte is already in this format, so the palette
  54. 620 ' information is used to set bits 4 and 5.  Line number 450 set
  55. 630 ' the high intensity bit, and line 650 sets the palette bit.
  56. 640 '
  57. 650 IF PALETTE=1 THEN BACKGROUND = BACKGROUND OR PALETTEBIT
  58. 660 OUT COLREG,BACKGROUND    ' Send color byte to the color register
  59. 670 DEF SEG = 0
  60. 680 MODE = PEEK(MODESAVE)                ' Get current mode
  61. 690 IF BURST = 0 THEN MODE = MODE AND (NOT BWENABLE)    ' Disable burst
  62. 700 IF BURST = 1 THEN MODE = MODE OR BWENABLE        ' or enable burst
  63. 710 POKE MODESAVE,MODE                    ' Save new mode
  64. 720 OUT MODEREG,MODE                    ' Send the mode byte
  65. 730 END
  66.  
  67. or enable burst
  68. 710 POKE MODESAVE,MODE                    ' Save new mode
  69. 720 OUT MODEREG,MODE                    ' Send th